home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Utilities
/
Workspace
/
Locus
/
Source
/
AppIconView.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
3KB
|
224 lines
/*
Copyright 1993 Jeremy Slade.
You are free to use all or any parts of the Locus project
however you wish, just give credit where credit is due.
The author (Jeremy Slade) shall not be held responsible
for any damages that result out of use or misuse of any
part of this project.
*/
/*
Project: Locus
Class: AppIconView
Description: See AppIconView.h
Original Author: Jeremy Slade
Revision History:
Created
V.101 JGS Tue Feb 2 18:50:26 GMT-0700 1993
*/
#import "AppIconView.h"
#import "Globals.h"
#import <dpsclient/psops.h>
@implementation AppIconView
+ initialize
{
[self setVersion:AppIconView_VERSION];
return ( self );
}
- init
/*
Automatically sizes the view to 48x48, the size of the icons.
*/
{
NXRect rect = { {8.0,8.0}, {48.0,48.0} };
[self initFrame:&rect];
return ( self );
}
- initFrame:(const NXRect *)frameRect
{
[super initFrame:frameRect];
isAttached = NO;
return ( self );
}
- free
{
[self detachFromIcon];
if ( icon ) NX_FREE ( icon );
return ( [super free] );
}
- attachToIcon:theWindow
{
// Attach to the window
if ( !isAttached && theWindow ) {
[[theWindow contentView] addSubview:self];
isAttached = YES;
[self display];
NXPing(); // Flush the display
}
return ( self );
}
- detachFromIcon
{
if ( isAttached ) {
[self removeFromSuperview];
isAttached = NO;
}
return ( self );
}
- setImage:anImage
{
image = anImage;
if ( icon ) {
NX_FREE ( icon );
icon = NULL;
}
[self display];
NXPing(); // Flush the display
return ( self );
}
- setIcon:(const char *)imageName;
{
if ( icon ) NX_FREE ( icon );
icon = NXCopyStringBuffer ( imageName );
image = [NXImage findImageNamed:imageName];
[self display];
NXPing(); // Flush the display
return ( self );
}
- (const char *)icon
{
return ( icon );
}
- image
{
return ( image );
}
- drawSelf:(const NXRect *)rects :(int)count
{
NXPoint point = {0.0, 0.0};
NXRect rect = bounds;
// draw the new image
[image composite:NX_SOVER toPoint:&point];
return ( self );
}
// -------------------------------------------------------------------------
// NXDraggingDestination Protocol - forward to folderController
// -------------------------------------------------------------------------
- setDraggingEnabled:(BOOL)flag
{
if ( flag == YES ) {
[self registerForDraggedTypes:dragInTypes count:DRAGINTYPES];
} else {
[self unregisterDraggedTypes];
}
return ( self );
}
- (NXDragOperation)draggingEntered:(id <NXDraggingInfo>)sender
{
[folderController setDragDest:self];
return ( [folderController draggingEntered:sender] );
}
- (NXDragOperation)draggingUpdated:(id <NXDraggingInfo>)sender
{
return ( [folderController draggingUpdated:sender] );
}
- draggingExited:(id <NXDraggingInfo>)sender
{
return ( [folderController draggingExited:sender] );
}
- (BOOL)prepareForDragOperation:(id <NXDraggingInfo>)sender
{
return ( [folderController prepareForDragOperation:sender] );
}
- (BOOL)performDragOperation:(id <NXDraggingInfo>)sender
{
return ( [folderController performDragOperation:sender] );
}
- concludeDragOperation:(id <NXDraggingInfo>)sender
{
return ( [folderController concludeDragOperation:sender] );
}
@end